<include file="Public:header" />
<div class="container main"> <include file="Public:left" />
  <div class="w790">
     <div class="table_">
     	<h1><a href="{:U('index',array('magic_id' => $magic['id']))}">返回{$magic.title}参与对象列表</a></h1>
     <table class="table table-bordered" width="100%" border="0" cellspacing="0" cellpadding="0">
 <thead>
 <tr>
    <td align="center">ID</td>
    <td align="center">用户名(登录名)</td>
    <td align="center">所属分组</td>
    <td align="center">审核</td>
    <td align="center">微信openid</td>
    </tr>
</thead>
<volist name="list" id="vo">
  <tr class="data_list">
    <td align="center"><input type="checkbox" name="id" id="id" class="sall" value="{$vo.id}" /></td>
    <td><a onClick="window.parent.addMemberid('{$vo.id}','{$vo.openid}','{$vo.username}');" href="javascript:;">{$vo.username}[{$vo.openid}]</a></td>
    <td>{$vo.groupname}</td>
    <td align="center"><eq name="vo['status']" value="1"><span class="status1 status_btn" field="status,{$vo.id}"></span><else/><span class="status0 status_btn" field="status,{$vo.id}"></span></eq></td>
    <td align="center"><a onClick="window.parent.addMemberid('{$vo.id}','{$vo.openid}','{$vo.username}');" href="javascript:;">{$vo.openid}</a></td>
    </tr>
</volist>
  <tr>
    <td colspan="5"><a href="javascript:void(0);" onclick="sall();">全选/反选</a> <a href="javascript:void(0);" onclick="rall();">全不选</a> 选中会员分配<input type="text" id="number">次机会<button class="mybutton" onClick="sendnumber();">确定</button></td>
    </tr><tr>
    <td colspan="5"><div class="pages">{$pages}</div></td>
    </tr>
</table></div>

  </div>
  <div class="clear"></div>
</div>
<script>	
	function sendnumber(){
		var ids=new Array();
		$('.sall').each(function(index, element) {
            if($(this).attr('checked')=='checked'){
				ids.push($(this).val());
			}
        });
		if(!ids.length>0){
			error('至少选择一个对象');
			return false;
		}
		var number = $('#number').val();
		var magic_id = {$magic.id};
		$.post('{:U('insert')}',{aid:ids.toString(),number:number,magic_id:magic_id},function(data){
			if(data.status == 1){
				success(data.info);
			}else{
				error(data.info);
			}
		},'json');
	}
</script>
<include file="Public:footer" />